import { init, h, styleModule, eventListenersModule } from "snabbdom";
//注册事件
const patch = init([
  styleModule,// handles styling on elements with support for animations
  eventListenersModule, // attaches event listeners
]);

//2,使用h()函数的第二个参数传入模块中使用的数据(对象)
let vnode = h('div', [
  h('h1', { style: { backgroundColor: 'red' } }, 'Hello World'),
  h('p', { on: { click: eventHandler } }, 'Hello p')
])

function eventHandler () {
  console.log('点击了p标签')
}

let app = document.querySelector('#app')
patch(app, vnode)
